package com.niiwoo.civet.account.enums;

import java.util.Arrays;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 开户方式
 */
@AllArgsConstructor
@Getter
public enum OpenAccountWayEnum {

    /** 平台 **/
    PERSON_BIND_BANK_CARD_REGISTER(OpenAccountMajorWay.PERSON_BIND_BANK_CARD_REGISTER, (byte) 1, "个人注册绑卡"),
    GROUP_ACCOUNT_CORRELATE(OpenAccountMajorWay.GROUP_ACCOUNT_CORRELATE, (byte) 2, "集团账户关联"),
    ACTIVATE(OpenAccountMajorWay.ACTIVATE, (byte) 5, "个人激活"),
    ENTERPRISE_ACTIVATE(OpenAccountMajorWay.ACTIVATE, (byte) 7, "企业激活"),

    /** 融360 **/
    R360_GROUP_ACCOUNT_CORRELATE(OpenAccountMajorWay.GROUP_ACCOUNT_CORRELATE, (byte) 4, "r360集团账户关联"),
    R360_ACTIVATE(OpenAccountMajorWay.ACTIVATE, (byte) 6, "融360个人激活"),
    R360_PERSON_BIND_BANK_CARD_REGISTER(OpenAccountMajorWay.PERSON_BIND_BANK_CARD_REGISTER, (byte) 3, "r360个人注册绑卡"),

    /** 卡牛 **/
    CARD_NIU_GROUP_ACCOUNT_CORRELATE(OpenAccountMajorWay.GROUP_ACCOUNT_CORRELATE, (byte) 8, "卡牛集团账户关联"),
    CARD_NIU_ACTIVATE(OpenAccountMajorWay.ACTIVATE, (byte) 9, "卡牛个人激活"),
    CARD_NIU_PERSON_BIND_BANK_CARD_REGISTER(OpenAccountMajorWay.PERSON_BIND_BANK_CARD_REGISTER, (byte) 10, "卡牛个人注册绑卡"),

    /** 机构极速借 **/
    ORG_BIND_BANK_CARD_REGISTER(OpenAccountMajorWay.PERSON_BIND_BANK_CARD_REGISTER, (byte) 11, "机构借款人个人注册绑卡"),

    /** 汇介 **/
    HUIJIE_BIND_BANK_CARD_REGISTER(OpenAccountMajorWay.PERSON_BIND_BANK_CARD_REGISTER, (byte) 12, "汇介个人注册绑卡");

    private OpenAccountMajorWay major;
    private Byte value;
    private String desc;

    public static OpenAccountWayEnum of(Byte value) {
        if (value != null) {
            for (OpenAccountWayEnum s : values()) {
                if (s.value.equals(value)) {
                    return s;
                }
            }
        }
        return null;
    }

    public static boolean except(Byte value, OpenAccountWayEnum... status) {
        return (status != null && status.length > 0) && Arrays.asList(status).contains(of(value));
    }

}
